<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Setup</title>
    <script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
    <style>
    </style>
</head>
<body>
    <div id="Application"> 
        <com name="组件名"></com>    
    </div>
    <script>   
        const App = Vue.createApp({})
        App.component("com",{
            setup (props, context) {
                console.log(props.name)
                // 属性
                console.log(context.attrs)
                // 插槽 
                console.log(context.slots)
                // 触发事件 
                console.log(context.emit)
                let data = "setup的数据";
                Vue.onMounted(()=>{
                    console.log("setup定义的mounted")
                })
                return () => Vue.h('div', [data])
            },
            props: {
                name: String,
            },
            mounted() {
                console.log("组件内定义的mounted")
            }
            // template:`
            //     <div>{{data}}</div>
            // `
        })
        App.mount("#Application") 
    </script>
</body>
</html>